﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using PPI.Client.Logic;
using PPI.Entities.Kml;

namespace PPI
{
    public partial class frmKml : DevComponents.DotNetBar.Office2007RibbonForm
    {
        public frmKml()
        {
            InitializeComponent();
        }

        private void btnUpdate_Click(object sender, EventArgs e)
        {
            //LSettings.Update(1, txtKml.Text);
            MessageBox.Show("KML information saved correctly");
        }

        private void btnDownload_Click(object sender, EventArgs e)
        {
            if(sfdDownload.ShowDialog() == DialogResult.OK)
            {
                //List<EKmlFile> listKml = new List<EKmlFile>();
                //EKmlFile _DownloadKml = new EKmlFile();
                //_DownloadKml.TypeKMLElement = TypeKMLOfElement.CurrentPosition;
                //_DownloadKml.GUID = "1";
                //_DownloadKml.KMLCode = txtKml.Text;
                
                //listKml.Add(_DownloadKml);

                //string _KMLCode = GEHelper.GenerateKMLFile(ref listKml);
                //FileInfo newFile = new FileInfo(sfdDownload.FileName);
                //if (newFile.Exists)
                //{
                //    newFile.Create();
                //}
                //GEHelper.WriteKMLFile(_KMLCode, newFile.FullName);
                //MessageBox.Show("KML information saved correctly");
            } 
        }

        private void frmKml_Load(object sender, EventArgs e)
        {
            //txtKml.Text = LSettings.SelectKML()[0].KMLCode;
        }

        private void btnClose_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
